<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <style>
        #box{
            width: 500px;
            height: 100px;
            border: 2px solid rosybrown;
            margin-top: 5px;
        }
    </style>
</head>
<body>

    <input type="text" name="t">&nbsp;
    <button>复制</button>
    <div id="box" name="d"></div>
 
    <script> 
        var txt= document.getElementsByTagName('input');
        var bu=document.getElementById('box');     
        bu.onclick=function(){
            var test=document.getElementsByName('t');
            var a=test.value;
            var test2=document.getElementsByName('d');
            d=test.value;
        }
    </script>

    <!-- 有个button,有个h2(封校三天 快乐无边),当点击button时会显示文字，再次点击会文字会消失。
    --onclick  -->
    <h2>封校三天 快乐无边</h2>
    <BUtton onclick="start">点击</BUtton>
    <script>
        function start() {
            var bu=2;
           for (let i = 0; i < bu.length; i++) {
            if (i==1) {
                 document.querySelectorAll('h2');
            }else{
                 document.querySelector('');
             }    
           }
        } 
    </script>

</body>
</html>